<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>addID2</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <script src="layui/layui.js"></script>
    <script src="js/jquery-1.4.2.js"></script>
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">ID</label>
        <div class="layui-input-inline">
            <input type="text" name="id" required  lay-verify="required" placeholder="请输入ID" autocomplete="off" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">日期</label>
        <div class="layui-input-inline">
            <input type="text" id="date" name="date" required  lay-verify="required" placeholder="请选择日期" class="layui-input" />
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">高风险点位数</label>
        <div class="layui-input-inline">
            <input type="text" name="high" required  lay-verify="required" placeholder="请输入高风险点位数" autocomplete="off" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">中风险点位数</label>
        <div class="layui-input-inline">
            <input type="text" name="zhong" required  lay-verify="required" placeholder="请输入中风险点位数" autocomplete="off" class="layui-input" />
        </div>
    </div>
	
	<div class="layui-form-item">
	    <label class="layui-form-label">低风险点位数</label>
	    <div class="layui-input-inline">
	        <input type="text" name="low" required  lay-verify="required" placeholder="请输入低风险点位数" autocomplete="off" class="layui-input" />
	    </div>
	</div>
	
	<div class="layui-form-item">
	    <label class="layui-form-label">近期上报数量</label>
	    <div class="layui-input-inline">
	        <input type="text" name="sum1" required  lay-verify="required" placeholder="请输入近期上报数量" autocomplete="off" class="layui-input" />
	    </div>
	</div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">清空</button>
        </div>
    </div>

</form>

<script>
    //Demo
    layui.use('laydate',function () {
        var laydate=layui.laydate;

        laydate.render({
            elem:'#date',
            type:'datetime'
        });

    });

    layui.use('form',function () {
        var $=layui.jquery;
		var form=layui.form;
		var laydate=layui.laydate;
        form.on('submit(formDemo)',function (data) {
            $.ajax({
                url:'/api/riskPoint/insert',
                type:"post",
                data:$('#formSubmit').serialize(),
                success:function(res){
                    if (res.code==200){
                        layer.msg("修改成功",{time:1000})
                        // layer.msg(res.exthend.msg,{time:1000})
                    }else{
                        layer.msg(res.extend.msg,{time:1000})
                    }
                },
                error:function(){
                    layer.alert("发生异常！请重试")
                }
            })
            return false;
        });
    });
</script>
</body>
</html>